package edu.ubb.remeye.security.manager.none;

import org.apache.mina.core.session.IoSession;

import edu.ubb.remeye.communication.message.Message;
import edu.ubb.remeye.security.manager.AbstractServerSecurity;

/**
 * Server authentication class for none security.
 * 
 * @author Andrew Ianicicau
 *
 */
public class ServerNoneAuthenticator extends AbstractServerSecurity {
	
	///////////////////////////////////////////////////////////////////////////////////
	////	CONSTRUCTORS - ServerNoneAuthenticator
	///////////////////////////////////////////////////////////////////////////////////

	public ServerNoneAuthenticator(IoSession session) {
		this.session = session;
	}

	
	
	///////////////////////////////////////////////////////////////////////////////////
	////	METHODS - ServerNoneAuthenticator
	///////////////////////////////////////////////////////////////////////////////////

	/**
	 * Authentication.
	 */
	@Override
	public void run() {
		authenticate();
	}
	
	/**
	 * Server side authentication algorithm.
	 */
	private void authenticate() {
		// setting session attribute showing authentication success
		authenticationSucceeded();
		
		// setting session attribute showing end of authentication
		authenticationFinished();
	}

	/**
	 * No need for message forwarding.
	 */
	@Override
	public void forwardMessage(Message message) {
		// no message needed
	}
}
